﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;
using MM.Contract.Movies;
using MM.Contract.Categorias;
using Castle.MicroKernel.Registration;

namespace MM.Bootstrapper.Configurators
{
    public class ServiceConfigurator : IConfigurator
    {
        #region Miembros de IConfigurator

        public void Configure(IWindsorContainer container) {
            container.Register(AllTypes
               .FromAssembly(typeof(MovieService).Assembly)
               .Where(x => x.Namespace.Contains(".Movies"))
               .Configure(c => c.LifeStyle.Transient)
               .WithService.FirstInterface()
               );

            container.Register(AllTypes
               .FromAssembly(typeof(CategoriaService).Assembly)
               .Where(x => x.Namespace.Contains(".Categorias"))
               .Configure(c => c.LifeStyle.Transient)
               .WithService.FirstInterface()
               );

        }

        #endregion
    }
}
